]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Scale down background
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Wed, 17 Feb 2021 14:36:10 +0000 (11:36 -0300)
committerMarge Bot <marge-bot@gnome.org>
Sun, 21 Feb 2021 15:47:12 +0000 (15:47 +0000)
Scale down the background to 0.94 when in floating mode.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1691>

js/ui/workspace.js

index b849771a62f7e0d6e64bfbb4c0eeb15d82fdbcbe..ba632153b355003d33bad0599350ba5e8f2451e5 100644 (file)
@@ -24,6 +24,7 @@ var LAYOUT_SCALE_WEIGHT = 1;
 var LAYOUT_SPACE_WEIGHT = 0.1;
 
 const BACKGROUND_CORNER_RADIUS_PIXELS = 30;
+const BACKGROUND_SCALE = 0.94;
 
 // Window Thumbnail Layout Algorithm
 // =================================
@@ -868,7 +869,10 @@ class WorkspaceBackground extends St.Widget {
         this._workarea = Main.layoutManager.getWorkAreaForMonitor(monitorIndex);
 
         this._stateAdjustment = stateAdjustment;
-        stateAdjustment.connect('notify::value', () => this._updateBorderRadius());
+        stateAdjustment.connect('notify::value', () => {
+            this._updateBorderRadius();
+            this.queue_relayout();
+        });
 
         this._bin = new Clutter.Actor({
             layout_manager: new Clutter.BinLayout(),
@@ -923,6 +927,21 @@ class WorkspaceBackground extends St.Widget {
     }
 
     vfunc_allocate(box) {
+        const scaledBox = box.copy();
+        scaledBox.scale(BACKGROUND_SCALE);
+
+        const [scaledWidth, scaledHeight] = scaledBox.get_size();
+        scaledBox.set_origin(
+            box.x1 + (box.get_width() - scaledWidth) / 2,
+            box.y1 + (box.get_height() - scaledHeight) / 2);
+
+        const progress = this._stateAdjustment.value;
+
+        if (progress === 1)
+            box = scaledBox;
+        else if (progress !== 0)
+            box = box.interpolate(scaledBox, progress);
+
         this.set_allocation(box);
 
         const themeNode = this.get_theme_node();
@@ -937,8 +956,7 @@ class WorkspaceBackground extends St.Widget {
         const yOff = (contentHeight / this._workarea.height) *
             (this._workarea.y - monitor.y);
 
-        contentBox.x1 -= xOff;
-        contentBox.y1 -= yOff;
+        contentBox.set_origin(-xOff, -yOff);
         contentBox.set_size(xOff + contentWidth, yOff + contentHeight);
         this._backgroundGroup.allocate(contentBox);
     }